## [1] "Excluded 1 participants based on catch-trial performance."
trials = remove_quotes(format_data(read.csv("../../1_talker_specific_adaptation_prior_exp_test/data/1_talker_specific_adaptation_prior_exp_test-trials.csv")))
exp_trials = remove_quotes(read.csv("../../1_talker_specific_adaptation_prior_exp_test/data/1_talker_specific_adaptation_prior_exp_test-exp_trials.csv"))
conditions = read.csv("../../1_talker_specific_adaptation_prior_exp_test/data/1_talker_specific_adaptation_prior_exp_test-condition.csv")
subj_info = read.csv("../../1_talker_specific_adaptation_prior_exp_test/data/1_talker_specific_adaptation_prior_exp_test-subject_information.csv") %>% select(workerid, noticed_manipulation)
trials = merge(trials, conditions %>% select(workerid, condition), by=c("workerid"))
trials = merge(trials, subj_info, by=c("workerid"))
trials[, c("test_order", "first_speaker_type", "second_speaker_type", "confident_speaker")] = str_split(trials$condition, "_", simplify=T)
EXCLUDE_BELOW = 0.75
catch_trial_perf = get_correct_catch_trial_counts(exp_trials)
exclude = catch_trial_perf %>%
filter(catch_prop < EXCLUDE_BELOW) %>%
.$workerid
print(paste("Excluded", length(exclude), "participants based on catch-trial performance in Exp 1.."))
## [1] "Excluded 1 participants based on catch-trial performance in Exp 1.."
#final data
d.exp1 = trials %>% filter(., !(workerid %in% exclude))
#combine data from exp1 and exp3
d = rbind(d.exp1, d.exp3)
## `summarise()` has grouped output by 'workerid', 'percentage_blue', 'modal'. You
## can override using the `.groups` argument.
## `summarise()` has grouped output by 'percentage_blue', 'modal'. You can
## override using the `.groups` argument.
## `summarise()` has grouped output by 'workerid', 'percentage_blue', 'modal'. You
## can override using the `.groups` argument.
## `summarise()` has grouped output by 'workerid', 'percentage_blue', 'modal'. You
## can override using the `.groups` argument.
## `summarise()` has grouped output by 'percentage_blue', 'modal'. You can
## override using the `.groups` argument.
We use the AUC function with the splines
method to directly compute the AUC.
t-test and regression model with control variables:
##
## Two Sample t-test
##
## data: aucs.cautious$auc_diff and aucs.confident$auc_diff
## t = 4.7434, df = 250, p-value = 3.536e-06
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 9.08335 21.98205
## sample estimates:
## mean of x mean of y
## 20.942809 5.410111
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula:
## auc_diff ~ cond + test_order + first_speaker_type + confident_speaker +
## first_speaker_type * cond + (1 | workerid)
## Data: auc_d
##
## REML criterion at convergence: 2301.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.99577 -0.46121 0.01379 0.57936 1.89279
##
## Random effects:
## Groups Name Variance Std.Dev.
## workerid (Intercept) 194.3 13.94
## Residual 430.6 20.75
## Number of obs: 252, groups: workerid, 126
##
## Fixed effects:
## Estimate Std. Error df t value Pr(>|t|)
## (Intercept) 13.4314 1.8051 122.0000 7.441 1.55e-11 ***
## cond1 7.7724 1.3073 124.0000 5.945 2.61e-08 ***
## test_order1 2.2133 1.8042 122.0000 1.227 0.222269
## first_speaker_type1 -7.0973 1.8042 122.0000 -3.934 0.000139 ***
## confident_speaker1 -2.2698 1.8051 122.0000 -1.257 0.210990
## cond1:first_speaker_type1 -0.3787 1.3073 124.0000 -0.290 0.772559
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cond1 tst_r1 frs__1 cnfd_1
## cond1 0.000
## test_order1 0.031 0.000
## frst_spkr_1 -0.015 0.000 -0.001
## cnfdnt_spk1 -0.031 0.000 0.015 -0.031
## cnd1:frs__1 0.000 -0.016 0.000 0.000 0.000
library(mclust)
## Package 'mclust' version 5.4.10
## Type 'citation("mclust")' for citing this R package in publications.
##
## Attaching package: 'mclust'
## The following object is masked from 'package:DescTools':
##
## BrierScore
## The following object is masked from 'package:bootstrap':
##
## diabetes
aucs_diff = merge(aucs.cautious, aucs.confident, by=c("workerid"))
aucs_diff$diff_of_diffs = aucs_diff$auc_diff.x - aucs_diff$auc_diff.y
aucs_diff %>% ggplot(aes(x=diff_of_diffs)) + geom_density() + geom_jitter(aes(y=0), width=0, height=0.001) + ggtitle("Raw data + estimated density")
1 Cluster
fit1 = Mclust(aucs_diff$diff_of_diffs, G=1)
print(summary(fit1, parameters=2))
## ----------------------------------------------------
## Gaussian finite mixture model fitted by EM algorithm
## ----------------------------------------------------
##
## Mclust X (univariate normal) model with 1 component:
##
## log-likelihood n df BIC ICL
## -603.5952 126 2 -1216.863 -1216.863
##
## Clustering table:
## 1
## 126
##
## Mixing probabilities:
## 1
## 1
##
## Means:
## [1] 15.5327
##
## Variances:
## [1] 848.101
2 Clusters
fit2 = Mclust(aucs_diff$diff_of_diffs, G=2)
print(summary(fit2, parameters=T))
## ----------------------------------------------------
## Gaussian finite mixture model fitted by EM algorithm
## ----------------------------------------------------
##
## Mclust E (univariate, equal variance) model with 2 components:
##
## log-likelihood n df BIC ICL
## -593.5919 126 4 -1206.529 -1219.767
##
## Clustering table:
## 1 2
## 110 16
##
## Mixing probabilities:
## 1 2
## 0.8586232 0.1413768
##
## Means:
## 1 2
## 6.924947 67.810127
##
## Variances:
## 1 2
## 398.11 398.11
3 Clusters
fit3 = Mclust(aucs_diff$diff_of_diffs, G=3)
print(summary(fit3, parameters=T))
## ----------------------------------------------------
## Gaussian finite mixture model fitted by EM algorithm
## ----------------------------------------------------
##
## Mclust E (univariate, equal variance) model with 3 components:
##
## log-likelihood n df BIC ICL
## -593.6292 126 6 -1216.276 -1333.505
##
## Clustering table:
## 1 2 3
## 15 95 16
##
## Mixing probabilities:
## 1 2 3
## 0.3371770 0.5253839 0.1374390
##
## Means:
## 1 2 3
## 1.858188 10.425551 68.603082
##
## Variances:
## 1 2 3
## 384.2556 384.2556 384.2556
According to the Bayesian information criterion, a model with two clusters describes the data best.
Fitted model:
aucs_diff %>%
ggplot(aes(x=diff_of_diffs)) +
geom_jitter(aes(y=0, color=first_speaker_type.x), width=0, height=0.001) +
ggtitle("Raw data + Components of gaussian mixture") +
stat_function(fun = dnorm, args = list(mean = fit2$parameters$mean[1], sd = sqrt(fit2$parameters$variance$sigmasq[1]))) +
stat_function(fun = dnorm, args = list(mean = fit2$parameters$mean[2], sd = sqrt(fit2$parameters$variance$sigmasq[2])))
## Warning: Removed 101 row(s) containing missing values (geom_path).
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: binomial ( logit )
## Formula: most_likely_model ~ condition + test_order + first_speaker_type +
## first_speaker_type * condition + (1 | workerid)
## Data: d.post_test
##
## AIC BIC logLik deviance df.resid
## 298.6 319.7 -143.3 286.6 240
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.8870 -0.6145 -0.2432 0.6899 2.7631
##
## Random effects:
## Groups Name Variance Std.Dev.
## workerid (Intercept) 1.693 1.301
## Number of obs: 246, groups: workerid, 123
##
## Fixed effects:
## Estimate Std. Error z value
## (Intercept) -0.47550 0.21483 -2.213
## conditioncautious -1.00820 0.21698 -4.647
## test_orderparallel -0.44470 0.21172 -2.100
## first_speaker_typecautious 0.61038 0.22015 2.773
## conditioncautious:first_speaker_typecautious 0.08209 0.16821 0.488
## Pr(>|z|)
## (Intercept) 0.02687 *
## conditioncautious 3.38e-06 ***
## test_orderparallel 0.03569 *
## first_speaker_typecautious 0.00556 **
## conditioncautious:first_speaker_typecautious 0.62551
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cndtnc tst_rd frst__
## conditincts 0.264
## tst_rdrprll 0.131 0.239
## frst_spkr_t -0.193 -0.318 -0.138
## cndtncts:__ -0.125 -0.115 -0.028 0.106
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: likelihood_ratio ~ condition + test_order + first_speaker_type +
## first_speaker_type * condition + (1 | workerid)
## Data: d.post_test
##
## REML criterion at convergence: 3268.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.2301 -0.6277 -0.1118 0.4681 3.1266
##
## Random effects:
## Groups Name Variance Std.Dev.
## workerid (Intercept) 7336 85.65
## Residual 33961 184.29
## Number of obs: 246, groups: workerid, 123
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) -7.145 14.065 120.000
## conditioncautious -65.004 11.753 121.000
## test_orderparallel -17.405 14.061 120.000
## first_speaker_typecautious 47.939 14.065 120.000
## conditioncautious:first_speaker_typecautious 3.278 11.753 121.000
## t value Pr(>|t|)
## (Intercept) -0.508 0.61238
## conditioncautious -5.531 1.87e-07 ***
## test_orderparallel -1.238 0.21821
## first_speaker_typecautious 3.408 0.00089 ***
## conditioncautious:first_speaker_typecautious 0.279 0.78079
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cndtnc tst_rd frst__
## conditincts 0.000
## tst_rdrprll 0.008 0.000
## frst_spkr_t -0.024 0.000 0.008
## cndtncts:__ 0.000 -0.024 0.000 0.000
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: likelihood_ratio ~ condition + test_order + first_speaker_type +
## prior_likelihood_ratio + first_speaker_type * condition +
## (1 | workerid)
## Data: d.post_test
##
## REML criterion at convergence: 3266.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.1792 -0.5692 -0.1000 0.4569 3.4660
##
## Random effects:
## Groups Name Variance Std.Dev.
## workerid (Intercept) 6588 81.16
## Residual 33961 184.29
## Number of obs: 246, groups: workerid, 123
##
## Fixed effects:
## Estimate Std. Error df
## (Intercept) 11.6711 16.2900 119.0000
## conditioncautious -65.0040 11.7532 121.0000
## test_orderparallel -10.6059 14.1863 119.0000
## first_speaker_typecautious 46.7980 13.8568 119.0000
## prior_likelihood_ratio 0.2238 0.1021 119.0000
## conditioncautious:first_speaker_typecautious 3.2781 11.7532 121.0000
## t value Pr(>|t|)
## (Intercept) 0.716 0.47511
## conditioncautious -5.531 1.87e-07 ***
## test_orderparallel -0.748 0.45617
## first_speaker_typecautious 3.377 0.00099 ***
## prior_likelihood_ratio 2.193 0.03026 *
## conditioncautious:first_speaker_typecautious 0.279 0.78079
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr) cndtnc tst_rd frst__ prr_l_
## conditincts 0.000
## tst_rdrprll 0.122 0.000
## frst_spkr_t -0.040 0.000 0.000
## prr_lklhd_r 0.527 0.000 0.219 -0.038
## cndtncts:__ 0.000 -0.024 0.000 0.000 0.000
## Data: d.post_test
## Models:
## model1: likelihood_ratio ~ condition + test_order + first_speaker_type + first_speaker_type * condition + (1 | workerid)
## model2: likelihood_ratio ~ condition + test_order + first_speaker_type + prior_likelihood_ratio + first_speaker_type * condition + (1 | workerid)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## model1 7 3317.7 3342.3 -1651.9 3303.7
## model2 8 3314.9 3342.9 -1649.4 3298.9 4.8726 1 0.02729 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
| workerid | first_speaker_type | test_order | noticed_manipulation | cautious_count | confident_count | aligned_count | first_adaptation_speaker_count |
|---|---|---|---|---|---|---|---|
| 1352 | cautious | reverse | 1 | 1 | 1 | 2 | 1 |
| 1353 | confident | parallel | 0 | 1 | 1 | 2 | 1 |
| 1354 | cautious | parallel | 0 | 1 | 1 | 2 | 1 |
| 1355 | confident | reverse | 0 | 1 | 1 | 2 | 1 |
| 1359 | confident | reverse | 0 | 1 | 1 | 2 | 1 |
| 1365 | cautious | reverse | 0 | 1 | 1 | 2 | 1 |
| 1368 | confident | parallel | 1 | 1 | 1 | 2 | 1 |
| 1370 | confident | parallel | 1 | 1 | 1 | 2 | 1 |
| 1373 | cautious | reverse | 1 | 1 | 1 | 2 | 1 |
| 1375 | confident | reverse | 1 | 1 | 1 | 2 | 1 |
| 1385 | cautious | reverse | 1 | 1 | 1 | 2 | 1 |
| 1387 | cautious | reverse | 1 | 1 | 1 | 2 | 1 |
| 1391 | cautious | reverse | 1 | 1 | 1 | 2 | 1 |
| 1395 | cautious | parallel | 1 | 1 | 1 | 2 | 1 |
| 1397 | cautious | reverse | 1 | 1 | 1 | 2 | 1 |
| 1407 | confident | reverse | 0 | 1 | 1 | 2 | 1 |
| 1417 | cautious | reverse | 1 | 1 | 1 | 2 | 1 |
| 1423 | cautious | parallel | 1 | 1 | 1 | 2 | 1 |
| 1428 | cautious | parallel | 1 | 1 | 1 | 2 | 1 |
| 1432 | confident | reverse | 0 | 1 | 1 | 2 | 1 |
| 1507 | cautious | reverse | 0 | 1 | 1 | 2 | 1 |
| 1513 | confident | parallel | 1 | 1 | 1 | 2 | 1 |
| 1522 | confident | reverse | 1 | 1 | 1 | 2 | 1 |
| 1524 | confident | reverse | 0 | 1 | 1 | 2 | 1 |
| 1525 | cautious | reverse | 1 | 1 | 1 | 2 | 1 |
| 1527 | cautious | parallel | 1 | 1 | 1 | 2 | 1 |
| 1528 | confident | parallel | 1 | 1 | 1 | 2 | 1 |
| 1530 | cautious | reverse | 1 | 1 | 1 | 2 | 1 |
| 1532 | cautious | parallel | 0 | 1 | 1 | 2 | 1 |
| 1537 | confident | parallel | 1 | 1 | 1 | 2 | 1 |
| 1539 | cautious | reverse | 1 | 1 | 1 | 2 | 1 |
| 1541 | cautious | parallel | 1 | 1 | 1 | 2 | 1 |
| 1543 | confident | reverse | 0 | 1 | 1 | 2 | 1 |
| 1545 | confident | parallel | 0 | 1 | 1 | 2 | 1 |
| 1547 | cautious | reverse | 1 | 1 | 1 | 2 | 1 |
| 1548 | cautious | parallel | 1 | 1 | 1 | 2 | 1 |
| 1551 | confident | reverse | 0 | 1 | 1 | 2 | 1 |
| 1552 | confident | parallel | 1 | 1 | 1 | 2 | 1 |
| 1553 | confident | parallel | 0 | 1 | 1 | 2 | 1 |
| 1558 | confident | reverse | 1 | 1 | 1 | 2 | 1 |
| 1559 | confident | reverse | 1 | 1 | 1 | 2 | 1 |
| 1560 | confident | parallel | 1 | 1 | 1 | 2 | 1 |
| 1564 | cautious | parallel | 0 | 1 | 1 | 2 | 1 |
| 1566 | confident | reverse | 1 | 1 | 1 | 2 | 1 |
| 1571 | cautious | reverse | 0 | 1 | 1 | 2 | 1 |
| workerid | first_speaker_type | test_order | noticed_manipulation | cautious_count | confident_count | aligned_count | first_adaptation_speaker_count |
|---|---|---|---|---|---|---|---|
| 1404 | confident | parallel | 1 | 1 | 1 | 0 | 1 |
| 1406 | cautious | parallel | 0 | 1 | 1 | 0 | 1 |
| 1419 | confident | reverse | 0 | 1 | 1 | 0 | 1 |
| 1521 | cautious | parallel | 0 | 1 | 1 | 0 | 1 |
| 1546 | cautious | reverse | 0 | 1 | 1 | 0 | 1 |
## `summarise()` has grouped output by 'workerid', 'percentage_blue', 'modal'. You
## can override using the `.groups` argument.
## `summarise()` has grouped output by 'percentage_blue', 'modal'. You can
## override using the `.groups` argument.
## `summarise()` has grouped output by 'workerid', 'percentage_blue', 'modal'. You
## can override using the `.groups` argument.